//
//  OPPost.h
//  OPFramework
//
//  Created by malcom on 7/12/08.
//  Copyright 2008 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "OPBaseObject.h"
#import "OPForum.h"
#import "OPUser.h"

@class OPTopic;
@class OPForum;
@interface OPPost : OPBaseObject {
	// PROPERTIES
	int						p_postID;				// post id	
	NSString				*p_subject;				// subject of the post
	NSString				*p_message;				// html message
	OPUser					*p_author;				// author of the message
	NSDate					*p_postDate;			// post sending date
	
	// INTERNAL USE
	int						_parentTopicID;	
	int						_parentForumID;	
}

@property (readonly) int		p_postID;
@property (readonly) OPUser		*p_author;
@property (readonly) NSString	*p_subject;
@property (readonly) NSString	*p_message;
@property (readonly) NSDate		*p_postDate;

#pragma mark INIT METHODS
- (id) initLoadingPostWithID:(NSNumber *) _postid fromBoard:(OPBoard *) _board;

#pragma mark PUBLIC METHODS
- (BOOL) deleteFromServerAndResetPagesCache:(BOOL) _resetTopicPages withPassword:(NSString *) _password;

#pragma PARENT OBJECTS
- (OPTopic *) getParentTopicObject;
- (OPForum *) getParentForumObject;
- (int) getPostPageIndexInTopic;

#pragma mark PRIVATE METHODS
- (void) _loadResponseProperties:(NSDictionary *) _dict;
- (BOOL) _loadSyncWithID:(NSNumber *) _postid;
- (id) _initByLoadingResponsePostObject:(NSDictionary *) _dict fromTopic:(OPTopic *) _topic;
- (void) _parseResultsForGetPostInfo:(NSDictionary *) dict;
- (id) _initByLoadingResponsePostObject:(NSDictionary *) _dict fromTopicNumber:(NSNumber *) _num ofForum:(OPForum *) _forum;

@end
